//
//  HZWTableViewCell.m
//  开心一刻
//
//  Created by lanou on 16/4/12.
//  Copyright © 2016年 刘洋. All rights reserved.
//

#import "HZWTableViewCell.h"

@implementation HZWTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.myImage= [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, KedWidth, KedWidth/854*480)];
       
        self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake((KedWidth-250)/2, KedWidth/854*480/5*2, 250, 20)];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        [self.titleLabel setTextColor:[UIColor whiteColor]];
       // [self.titleLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:15]];
        self.titleLabel.font =[UIFont fontWithName:@"Helvetica-Bold" size:15];
        //self.titleLabel.font = [UIFont systemFontOfSize:14];
        
        self.styleLabel =[[UILabel alloc]initWithFrame:CGRectMake((KedWidth-100)/2, KedWidth/854*480/5*3, 100, 20)];
        [self.styleLabel setTextColor:[UIColor whiteColor]];
        self.styleLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_myImage];
        
        
        self.myview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KedWidth, KedWidth/854*480)];
        self.myview .backgroundColor = [UIColor blackColor];
        self.myview.alpha = 0.2;
        [self.myImage addSubview:_myview];
        
        [self.myImage addSubview:_titleLabel];
        [self.myImage addSubview:_styleLabel];

    }
    return self;
}
-(CGFloat)cellOffset
{
    CGRect centerToWindow =[self convertRect:self.bounds  toView:self.window];
    CGFloat centerY = CGRectGetMidY(centerToWindow);
    CGPoint windowCenter = self.superview.center;
    CGFloat cellOffsetY = centerY - windowCenter.y;
    CGFloat offsetDig = cellOffsetY/self.superview.frame.size.height * 2;
    CGFloat offset = -offsetDig*(KedHeight /1.7-250)/2;
    CGAffineTransform transY = CGAffineTransformMakeTranslation(0,offset);
    self.myImage.transform = transY;
    return offset;
 
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
